

package com.narunas.view.utils {
	import com.afw.swfaddress.SWFAddressUtil;
	import com.narunas.ApplicationFacade;
	import main;
	//import flash.display.MovieClip;
	import flash.display.Sprite;
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;

	public class PageErrorMediator extends Mediator implements IMediator{
		
		public static const NAME:String = "PageErrorMediator";
		
		public function PageErrorMediator(viewComponent:Object = null) {
			super(NAME, viewComponent);
		}
		
		override public function listNotificationInterests():Array{
			return [
					ApplicationFacade.PAGE_ERROR
					];
		}
		
		override public function handleNotification(notification:INotification):void{
			super.handleNotification(notification); 
			var uriSegments:Array = notification.getBody() as Array;
			
			switch(notification.getName()) {
				case ApplicationFacade.PAGE_ERROR:
					//base.holder.addChild(new Page404());
				break;
			}
			sendNotification(ApplicationFacade.TITLE_CHANGE, SWFAddressUtil.formatTitleSeg(uriSegments)  );
		}
		
		private function get base():Sprite {
			return main(app).base;
		}
		
		private function get app():main {
			return viewComponent as main;
		}
		
	}
	
}
